package cc.ab01;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.log4j.Logger;

import oracle.to.mysql.utils.SqlUtils;

public class A3_AB01_temp_Update {

	private static Logger log = Logger.getLogger(" ");
	static {
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			log.error("驱动加载异常：" + e.getMessage());
		}
	}
	private static final String AB01_TEMP_SQL = "select *from ab01_temp";

	public static void main(String[] args) throws SQLException, IOException {
		Connection connMysql = DriverManager.getConnection(SqlUtils.getMySqlUrl());
		Statement cs = connMysql.createStatement();
		ResultSet rs = cs.executeQuery(AB01_TEMP_SQL);
		while (rs.next()) {
			Object AAB001 = rs.getObject("AAB001");
			Object AAB004 = rs.getObject("AAB004");
			Object BAB004 = rs.getObject("BAB004");
			Object AAB003 = rs.getObject("AAB003");
			Object AAB022 = rs.getObject("AAB022");
			Object AAB019 = rs.getObject("AAB019");
			Object AAB020 = rs.getObject("AAB020");
			Object AAB301 = rs.getObject("AAB301");
			Object AAB302 = rs.getObject("AAB302");
			Object AAE006 = rs.getObject("AAE006");
			Object AAE007 = rs.getObject("AAE007");
			Object AAB007 = rs.getObject("AAB007");
			Object AAE045 = rs.getObject("AAE045");
			Object AAB048 = rs.getObject("AAB048");
			Object AAB056 = rs.getObject("AAB056");
			Object AAB091 = rs.getObject("AAB091");
			Object BAE006 = rs.getObject("BAE006");
			Object AAB007P = rs.getObject("AAB007P");
			Object AAE159 = rs.getObject("AAE159");
			Object AAE014 = rs.getObject("AAE014");
			Object AAE005 = rs.getObject("AAE005");
			Object BAE017 = rs.getObject("BAE017");
			Object AAE004 = rs.getObject("AAE004");
			Object AAE392 = rs.getObject("AAE392");
			Object AAB092 = rs.getObject("AAB092");
			Object AAB029 = rs.getObject("AAB029");
			Object AAB999 = rs.getObject("AAB999");
			Object DSOURCE = rs.getObject("DSOURCE");
			Object AAB01X = rs.getObject("AAB01X");
			Object DXP_CB20_AAB001 = rs.getObject("DXP_CB20_AAB001");
			Object UPDATE_TIME = rs.getObject("UPDATE_TIME");
			String updateSql = "update ab01_temp set BAB004=\'" + BAB004 + "\',AAB003=\'" + AAB003 + "\',AAB022=\'" + AAB022
					+ "\',AAB019=\'" + AAB019 + "\',AAB020=\'" + AAB020 + "\',AAB301=\'" + AAB301 + "\',AAB302=\'"
					+ AAB302 + "\',AAE006=\'" + AAE006 + "\',AAE007=\'" + AAE007 + "\',AAB007=\'" + AAB007
					+ "\',AAE045=\'" + AAE045 + "\',AAB048=\'" + AAB048 + "\',AAB048=\'" + AAB048 + "\',AAB056=\'"
					+ AAB056 + "\',AAB091=\'" + AAB091 + "\',BAE006=\'" + BAE006 + "\',AAB007P=\'" + AAB007P
					+ "\',AAE159=\'" + AAE159 + "\',AAE014=\'" + AAE014 + "\',AAE005=\'" + AAE005 + "\',BAE017=\'"
					+ BAE017 + "\',AAE004=\'" + AAE004 + "\',AAE392=\'" + AAE392 + "\',AAB092=\'" + AAB092
					+ "\',AAB029=\'" + AAB029 + "\',AAB999=\'" + AAB999 + "\',DSOURCE=\'" + DSOURCE + "\',AAB01X=\'"
					+ AAB01X + "\',DXP_CB20_AAB001=\'" + DXP_CB20_AAB001 + "\',UPDATE_TIME=\'" + UPDATE_TIME + "\'"
					+ " where AAB001=\'" + AAB001 + "\' and AAB004 = \'" + AAB004 + "\';";

			System.out.println(updateSql.replace("'null'", "NULL"));
		}
		cs.close();
		connMysql.close();
	}

}